import {api} from '@/api/api';
export default{
	data() {
		return {
			marqueeList:[],
			bannerlist:[],
		}
	},
    methods: {
      changeLanguage(data){
          this.getAnnouncementList();
          this.getBanner();
      },
      async getAnnouncementList() {
          let that = this;
          let params = {
              pageNum: 1,
              pageSize: 10000,
              typeCode: "announcementCenter"
          };
          let res = await api.announcementList(params);
          if (res.data.code == 0) {
              that.marqueeList = [];
              res.data.data.records.forEach((item,index)=>{
                  let nowtime = new Date().getTime();
                  let createtime = new Date(item.createTime).getTime();
                  if((nowtime-createtime)>1000*60*60*24*3){
                      item.isshowtime = true;
                  }else{
                      item.isshowtime = false
                  }
                  that.marqueeList.push(item);
              })
          } else {
              this.$layer.msg(res.data.msg);
          }
      },
      async getBanner() {
          let that = this;
          let params = {
              category: 1,
              platform: 1
          };
          let res = await api.bannerList(params);
          if (res.data.code == 0) {
              that.bannerlist = [];
              res.data.data.forEach((item,index)=>{
                  that.bannerlist.push(item);
              })
          } else {
              this.$layer.msg(res.data.msg);
          }
      },
    },
}
